<!--#include file="../inc/easp/easp.asp"-->
<!--#include file="../inc/conn1.asp"-->
<!--#include file="../inc/checklogin.asp"-->
<!--#include file="../inc/easyide.asp"-->
<% CheckLogin("../index.asp") %>
<%
  If Session("Authority") = "1" Then
    Response.Write "<script type=""text/javascript"">alert('Delete failed!');top.location.href='index.asp';</script>"
  End if
%>
<%
  dim y_id,g_id,op,groupdir
  dim ot_HH1,ot_HH2,ot_HH3,ot_HH4,ot_HH5,ot_HH6,ot_HH7
  dim ot_MM1,ot_MM2,ot_MM3,ot_MM4,ot_MM5,ot_MM6,ot_MM7
  dim ct_HH1,ct_HH2,ct_HH3,ct_HH4,ct_HH5,ct_HH6,ct_HH7
  dim ct_MM1,ct_MM2,ct_MM3,ct_MM4,ct_MM5,ct_MM6,ct_MM7
  
  y_id = Trim(Request.Form("Country"))
  g_id = Trim(Request.Form("Group"))  
  op = Trim(Request.Form("Operate"))
  groupdir = Trim(Request.Form("txtGroupDir"))
  if right(groupdir, 1) = "/" or right(groupdir, 1) = "\" then
  	groupdir = left(groupdir, len(groupdir) -1)
  end if
  
  ot_HH1 = Request.Form("ot_HH1")
  ot_HH2 = Request.Form("ot_HH2")
  ot_HH3 = Request.Form("ot_HH3")
  ot_HH4 = Request.Form("ot_HH4")
  ot_HH5 = Request.Form("ot_HH5")
  ot_HH6 = Request.Form("ot_HH6")
  ot_HH7 = Request.Form("ot_HH7")

  ot_MM1 = Request.Form("ot_MM1")
  ot_MM2 = Request.Form("ot_MM2")
  ot_MM3 = Request.Form("ot_MM3")
  ot_MM4 = Request.Form("ot_MM4")
  ot_MM5 = Request.Form("ot_MM5")
  ot_MM6 = Request.Form("ot_MM6")
  ot_MM7 = Request.Form("ot_MM7")

  ct_HH1 = Request.Form("ct_HH1")
  ct_HH2 = Request.Form("ct_HH2")
  ct_HH3 = Request.Form("ct_HH3")
  ct_HH4 = Request.Form("ct_HH4")
  ct_HH5 = Request.Form("ct_HH5")
  ct_HH6 = Request.Form("ct_HH6")
  ct_HH7 = Request.Form("ct_HH7")

  ct_MM1 = Request.Form("ct_MM1")
  ct_MM2 = Request.Form("ct_MM2")
  ct_MM3 = Request.Form("ct_MM3")
  ct_MM4 = Request.Form("ct_MM4")
  ct_MM5 = Request.Form("ct_MM5")
  ct_MM6 = Request.Form("ct_MM6")
  ct_MM7 = Request.Form("ct_MM7")
  
  '创建目录{{
  if not file_createmulti(groupdir, 0) then
  	Easp.wc "<script type=""text/javascript"">alert('Save Failed!');top.location.href='index.asp';</script>"
  end if
  '}}
  
  dim rs,filename
  set rs = Easp.db.GetRecordDetail("Country","y_id=" & y_id & "")
  If Not Easp.IsN(rs) Then
  	dim xmlfile,fso,MyFile
  	filename = "times" & rs("CountryName") & ".xml"
  	xmlfile = server.mappath(groupdir & "/" & filename)
  	Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.CreateTextFile(xmlfile,True)
    MyFile.WriteLine("<?xml version=""1.0"" encoding=""utf-8""?>")
    MyFile.WriteLine("	<Times>")
    MyFile.WriteLine("		<TimesOpenhhmon>"& ot_HH1 &"</TimesOpenhhmon>")
    MyFile.WriteLine("		<TimesOpenhhthu>"& ot_HH2 &"</TimesOpenhhthu>")
    MyFile.WriteLine("		<TimesOpenhhwed>"& ot_HH3 &"</TimesOpenhhwed>")
    MyFile.WriteLine("		<TimesOpenhhtue>"& ot_HH4 &"</TimesOpenhhtue>")
    MyFile.WriteLine("		<TimesOpenhhfri>"& ot_HH5 &"</TimesOpenhhfri>")
    MyFile.WriteLine("		<TimesOpenhhsat>"& ot_HH6 &"</TimesOpenhhsat>")
    MyFile.WriteLine("		<TimesOpenhhsun>"& ot_HH7 &"</TimesOpenhhsun>")
    MyFile.WriteLine("		<TimesOpenmmmon>"& ot_MM1 &"</TimesOpenmmmon>")
    MyFile.WriteLine("		<TimesOpenmmthu>"& ot_MM2 &"</TimesOpenmmthu>")
    MyFile.WriteLine("		<TimesOpenmmwed>"& ot_MM3 &"</TimesOpenmmwed>")
    MyFile.WriteLine("		<TimesOpenmmtue>"& ot_MM4 &"</TimesOpenmmtue>")
    MyFile.WriteLine("		<TimesOpenmmfri>"& ot_MM5 &"</TimesOpenmmfri>")
    MyFile.WriteLine("		<TimesOpenmmsat>"& ot_MM6 &"</TimesOpenmmsat>")
    MyFile.WriteLine("		<TimesOpenmmsun>"& ot_MM7 &"</TimesOpenmmsun>")
    MyFile.WriteLine("		<TimesClosehhmon>"& ct_HH1 &"</TimesClosehhmon>")
    MyFile.WriteLine("		<TimesClosehhthu>"& ct_HH2 &"</TimesClosehhthu>")
    MyFile.WriteLine("		<TimesClosehhwed>"& ct_HH3 &"</TimesClosehhwed>")
    MyFile.WriteLine("		<TimesClosehhtue>"& ct_HH4 &"</TimesClosehhtue>")
    MyFile.WriteLine("		<TimesClosehhfri>"& ct_HH5 &"</TimesClosehhfri>")
    MyFile.WriteLine("		<TimesClosehhsat>"& ct_HH6 &"</TimesClosehhsat>")
    MyFile.WriteLine("		<TimesClosehhsun>"& ct_HH7 &"</TimesClosehhsun>")
    MyFile.WriteLine("		<TimesClosemmmon>"& ct_MM1 &"</TimesClosemmmon>")
    MyFile.WriteLine("		<TimesClosemmthu>"& ct_MM2 &"</TimesClosemmthu>")
    MyFile.WriteLine("		<TimesClosemmwed>"& ct_MM3 &"</TimesClosemmwed>")
    MyFile.WriteLine("		<TimesClosemmtue>"& ct_MM4 &"</TimesClosemmtue>")
    MyFile.WriteLine("		<TimesClosemmfri>"& ct_MM5 &"</TimesClosemmfri>")
    MyFile.WriteLine("		<TimesClosemmsat>"& ct_MM6 &"</TimesClosemmsat>")
    MyFile.WriteLine("		<TimesClosemmsun>"& ct_MM7 &"</TimesClosemmsun>")
    MyFile.WriteLine("	</Times>")
    MyFile.Close
    
    Response.Write "<script type=""text/javascript"">alert('Successfully saved!');top.location.href='index.asp';</script>"
    Easp.db.C(rs)
    
    '更新国家对应TimesFile{{
    dim result
    result = Easp.db.UpdateRecord("Country", Array("y_id:" & y_id, "g_id:" & g_id), Array("TimesFile:" & filename))
    If result<>0 Then
      'Response.Write("更新数据成功！") 
    End If
    '}}    
  Else
  	Response.Write "<script type=""text/javascript"">alert('Save Failed!');top.location.href='index.asp';</script>"
  	Easp.db.C(rs)
  End If
%>
